/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.opgea.appstreet.web.controller;

import com.opgea.appstreet.domain.model.JsonModelMap;
import com.opgea.appstreet.domain.model.SimpleModel;
import com.opgea.appstreet.service.UtilService;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 * @author Ramesh
 */
@Controller
@RequestMapping(value="util")
public class UtilController {
    
    @Autowired
    private UtilService utilService;
    
    @RequestMapping(method= RequestMethod.GET, value="countryList")
    public @ResponseBody
            Map<String, Object> getCountryList(){
        System.out.println("util/countryList");
        List<SimpleModel> countryList = utilService.getAllCountries();
        return JsonModelMap.success().data(countryList);
    }
    
    @RequestMapping(method= RequestMethod.GET, value="categoryList")
    public @ResponseBody
            Map<String, Object> getCategoryList(){
        System.out.println("util/categoryList");
        List<SimpleModel> categoryList = utilService.getAllCategories();
        return JsonModelMap.success().data(categoryList);
    }
    
    @RequestMapping(method= RequestMethod.GET, value="cityList")
    public @ResponseBody
            Map<String, Object> getCityList(){
        System.out.println("util/cityList");
        List<SimpleModel> cityList = utilService.getAllCities();
        return JsonModelMap.success().data(cityList);
    }
}
